<?php

namespace App\Http\Middleware;

use Closure;
use DB;
class ErrorsMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $data = DB::table('websize') -> select('switch') -> get();
        //var_dump($data);
        if($data[0] -> switch == 2)
        {

            return redirect('/errors');
        }else{
            return $next($request);
        }
    }
}
